package cn.mazexal.examapi.models.enums;

import lombok.Getter;

@Getter
public enum UnitEnum {
    // 1 分钟 2 小时 3 天 4月 5 年
    MINUTE(1, "分钟"),
    HOUR(2, "小时"),
    DAY(3, "天"),
    MONTH(4, "月"),
    YEAR(5, "年"),
    WEEK(6, "周");
    private int value;
    private String name;

    public static UnitEnum toEnum(int value) {
        for (UnitEnum item : values()) {
            if (item.value == value) {
                return item;
            }
        }
        return null;
    }

    UnitEnum(int value, String name) {
        this.value = value;
        this.name = name;
    }
}
